<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/ckform.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/showdate.js"></script>
	<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
	<script src="${pageContext.request.contextPath}/js/date.js"></script>
	<script>

		function getBlog(){
            //加载博客信息
            $.ajax({
                url:"${pageContext.request.contextPath}/blog/getBlogByBid",
                type:"post",
                data:{"bid":${bid}},
                dataType:"json",
                cache:false,
                success:function(rs){


                    $("#uname").html("<a href='${pageContext.request.contextPath}/user/user_detail?uid="+rs.user.uid+"'>"+rs.user.uname+"</a>");
                    $("#email").text(rs.user.email);
                    $("#content").text(rs.blog.bcontent);
                    $("#time").text(get_date(rs.blog.date));

                    $("#evaluates").empty();
                    $(rs.evaluateList).each(function(index,element){

                        var tr="<tr>\n" +
                            "<td style='display:none'>"+element.eid+"</td>"+
                            "\t\t\t<td>"+element.econtent+"</td>\n" +
                            "\t\t\t<td>"+get_date(element.etime)+"</td>\n" +
                            "\t\t\t<td><button type=\"button\"  class=\"deletecomment\">删除</button></td>\n" +
                            "\t\t</tr>";
                        $("#evaluates").append(tr);
                    });


                }
            });
		}
		$(function(){

            getBlog();
			  //评论的删除
			$(document).on("click",".deletecomment",function(event){

			    var eid= $(this).parents("tr").children().eq(0).text();
			    $.ajax({
                    url:"${pageContext.request.contextPath}/evaluate/deleteEvaluateByEid",
                    type:"post",
                    data:{"eid":eid},
                    dataType:"json",
                    cache:false,
                    success:function(rs){
                        if(rs.status==200){
                            getBlog();
						}else{
                            alert(rs.msg);
						}

					}
				});
			});
		})
	</script>
    <style type="text/css">
        body {font-size: 20px;
             padding-bottom: 40px;
             background-color:#e9e7ef;
             font-size:17px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
</head>
<h3><strong>博客信息：</strong></h3>
      <table class="table table-condensed">
               <tr>              
	              <td width="18%" height="30" align="center">博主名称：</td>
	              <td id="uname" width="82%" class="word_grey">
					 <%--博主名称--%>
				  </td>
	            </tr>
	            <tr>
	              <td height="28" align="center">邮箱</td>
	              <td height="28" id="email">fendou@fendou.com</td>
	            </tr>
				  <tr>
					  <td height="28" align="center">发布内容：</td>
					  <td height="28" id="content">的设计费看就看的房间</td>
				  </tr>
	            <tr>
	              <td height="28" align="center">发布时间：</td>
	              <td height="28" id="time" >2022-11-15 12:33:23</td>
	            </tr>
	  </table>

<h3><strong>全部评价内容：</strong></h3>
<table class="table table-bordered">
	<thead>
		<tr>
			<th>评价内容</th>
			<%--<th>评价人</th>--%>
			<th>评价时间</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody id="evaluates">
		<%--追加评论信息--%>

	</tbody>
</table>
</body>

</html>
